package com.jdd.enterprise.domain.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
//import com.jdd.common.base.container.PageRequest;
import com.jdd.enterprise.api.dto.PageRequest;
import com.jdd.enterprise.api.vo.ApiResponse;
import com.jdd.enterprise.api.vo.PageResponse;
import com.jdd.enterprise.domain.entity.Specification;
import com.jdd.enterprise.domain.mapper.SpecificationMapper;
import com.jdd.enterprise.util.PageUtil;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SpecificationService extends ServiceImpl<SpecificationMapper, Specification> {
    @Autowired
    private SpecificationMapper specificationMapper;
    public PageResponse<Specification> showList(PageRequest<Specification> request) {


        LambdaQueryWrapper<Specification> wrapper = Wrappers.lambdaQuery(Specification.class);

        List<Specification> specifications = specificationMapper.selectList(wrapper);

        PageResponse<Specification> page = PageUtil.createPage(request.getCurrentPage(), request.getPageSize());

        PageUtil.refreshData(page, (long) specifications.size(),specifications);




        return page;
    }
}
